Skip to content

Conversation

danko-d
Copy link
Contributor

@danko-d danko-d commented Aug 10, 2020

Fix for the new test TestFetchAllPropertiesAfterEntityIsInitialized in FetchLazyPropertiesFixture.

Prior to this fix, the second query below would fail:

Person person;
using(var s = OpenSession())
{
    person = s.CreateQuery("from Person where Id = 1").UniqueResult<Person>();
    var image = person.Image;
    person = s.CreateQuery("from Person fetch all properties where Id = 1").UniqueResult<Person>();
}

The problem was with the indexes and lazyIndexes arrays in InitializeLazyProperties() of AbstractEntityPersister when allLazyProperties was true. This could, in turn, cause IndexOutOfRangeException or InvalidCastException.

@maca88
Copy link
Contributor

maca88 commented Aug 11, 2020

@danko-d thanks for the fix, which fixes a regression made by #1922.

@bahusoid bahusoid changed the base branch from master to 5.3.x August 11, 2020 16:55
@bahusoid

This comment has been minimized.

@bahusoid bahusoid force-pushed the fetch-lazy-properties branch from 510249c to 0fda4c4 Compare August 12, 2020 07:07
@fredericDelaporte fredericDelaporte changed the title Fetch all lazy properties when entity is already loaded Fetch all lazy properties when entity is already loaded fails Aug 16, 2020
@fredericDelaporte fredericDelaporte merged commit 80ecd2e into nhibernate:5.3.x Aug 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants